{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 载入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "path2 = \"./Euro 2012 stats TEAM.csv\"      # Euro2012_stats.csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>81.3%</td>\n",
       "      <td>41</td>\n",
       "      <td>62</td>\n",
       "      <td>2</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>9</td>\n",
       "      <td>60.1%</td>\n",
       "      <td>53</td>\n",
       "      <td>73</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>25</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>18</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>17.2%</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>22</td>\n",
       "      <td>88.1%</td>\n",
       "      <td>43</td>\n",
       "      <td>45</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>37.9%</td>\n",
       "      <td>6.5%</td>\n",
       "      <td>65</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>54.6%</td>\n",
       "      <td>36</td>\n",
       "      <td>51</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>65.1%</td>\n",
       "      <td>67</td>\n",
       "      <td>48</td>\n",
       "      <td>12</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>6</td>\n",
       "      <td>34</td>\n",
       "      <td>45</td>\n",
       "      <td>43.0%</td>\n",
       "      <td>7.5%</td>\n",
       "      <td>110</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>20</td>\n",
       "      <td>74.1%</td>\n",
       "      <td>101</td>\n",
       "      <td>89</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "      <td>18</td>\n",
       "      <td>18</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>2</td>\n",
       "      <td>12</td>\n",
       "      <td>36</td>\n",
       "      <td>25.0%</td>\n",
       "      <td>4.1%</td>\n",
       "      <td>60</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>12</td>\n",
       "      <td>70.6%</td>\n",
       "      <td>35</td>\n",
       "      <td>30</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>2</td>\n",
       "      <td>15</td>\n",
       "      <td>23</td>\n",
       "      <td>39.4%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>48</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>48</td>\n",
       "      <td>56</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>6</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>34.3%</td>\n",
       "      <td>9.3%</td>\n",
       "      <td>82</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>71.5%</td>\n",
       "      <td>73</td>\n",
       "      <td>90</td>\n",
       "      <td>10</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>12</td>\n",
       "      <td>36.8%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>17</td>\n",
       "      <td>65.4%</td>\n",
       "      <td>43</td>\n",
       "      <td>51</td>\n",
       "      <td>11</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>31</td>\n",
       "      <td>22.5%</td>\n",
       "      <td>12.5%</td>\n",
       "      <td>59</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>77.0%</td>\n",
       "      <td>34</td>\n",
       "      <td>43</td>\n",
       "      <td>4</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>15</td>\n",
       "      <td>93.8%</td>\n",
       "      <td>102</td>\n",
       "      <td>83</td>\n",
       "      <td>19</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>17</td>\n",
       "      <td>17</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>5</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>47.2%</td>\n",
       "      <td>13.8%</td>\n",
       "      <td>39</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>8</td>\n",
       "      <td>61.6%</td>\n",
       "      <td>35</td>\n",
       "      <td>51</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>2</td>\n",
       "      <td>7</td>\n",
       "      <td>26</td>\n",
       "      <td>21.2%</td>\n",
       "      <td>6.0%</td>\n",
       "      <td>38</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>76.5%</td>\n",
       "      <td>48</td>\n",
       "      <td>31</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>16 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Goals  Shots on target  Shots off target  \\\n",
       "0               Croatia      4               13                12   \n",
       "1        Czech Republic      4               13                18   \n",
       "2               Denmark      4               10                10   \n",
       "3               England      5               11                18   \n",
       "4                France      3               22                24   \n",
       "5               Germany     10               32                32   \n",
       "6                Greece      5                8                18   \n",
       "7                 Italy      6               34                45   \n",
       "8           Netherlands      2               12                36   \n",
       "9                Poland      2               15                23   \n",
       "10             Portugal      6               22                42   \n",
       "11  Republic of Ireland      1                7                12   \n",
       "12               Russia      5                9                31   \n",
       "13                Spain     12               42                33   \n",
       "14               Sweden      5               17                19   \n",
       "15              Ukraine      2                7                26   \n",
       "\n",
       "   Shooting Accuracy % Goals-to-shots  Total shots (inc. Blocked)  \\\n",
       "0              51.9%            16.0%                          32   \n",
       "1              41.9%            12.9%                          39   \n",
       "2              50.0%            20.0%                          27   \n",
       "3              50.0%            17.2%                          40   \n",
       "4              37.9%             6.5%                          65   \n",
       "5              47.8%            15.6%                          80   \n",
       "6              30.7%            19.2%                          32   \n",
       "7              43.0%             7.5%                         110   \n",
       "8              25.0%             4.1%                          60   \n",
       "9              39.4%             5.2%                          48   \n",
       "10             34.3%             9.3%                          82   \n",
       "11             36.8%             5.2%                          28   \n",
       "12             22.5%            12.5%                          59   \n",
       "13             55.9%            16.0%                         100   \n",
       "14             47.2%            13.8%                          39   \n",
       "15             21.2%             6.0%                          38   \n",
       "\n",
       "    Hit Woodwork  Penalty goals  Penalties not scored      ...       \\\n",
       "0              0              0                     0      ...        \n",
       "1              0              0                     0      ...        \n",
       "2              1              0                     0      ...        \n",
       "3              0              0                     0      ...        \n",
       "4              1              0                     0      ...        \n",
       "5              2              1                     0      ...        \n",
       "6              1              1                     1      ...        \n",
       "7              2              0                     0      ...        \n",
       "8              2              0                     0      ...        \n",
       "9              0              0                     0      ...        \n",
       "10             6              0                     0      ...        \n",
       "11             0              0                     0      ...        \n",
       "12             2              0                     0      ...        \n",
       "13             0              1                     0      ...        \n",
       "14             3              0                     0      ...        \n",
       "15             0              0                     0      ...        \n",
       "\n",
       "    Saves made  Saves-to-shots ratio  Fouls Won Fouls Conceded  Offsides  \\\n",
       "0           13                 81.3%         41             62         2   \n",
       "1            9                 60.1%         53             73         8   \n",
       "2           10                 66.7%         25             38         8   \n",
       "3           22                 88.1%         43             45         6   \n",
       "4            6                 54.6%         36             51         5   \n",
       "5           10                 62.6%         63             49        12   \n",
       "6           13                 65.1%         67             48        12   \n",
       "7           20                 74.1%        101             89        16   \n",
       "8           12                 70.6%         35             30         3   \n",
       "9            6                 66.7%         48             56         3   \n",
       "10          10                 71.5%         73             90        10   \n",
       "11          17                 65.4%         43             51        11   \n",
       "12          10                 77.0%         34             43         4   \n",
       "13          15                 93.8%        102             83        19   \n",
       "14           8                 61.6%         35             51         7   \n",
       "15          13                 76.5%         48             31         4   \n",
       "\n",
       "    Yellow Cards  Red Cards  Subs on  Subs off  Players Used  \n",
       "0              9          0        9         9            16  \n",
       "1              7          0       11        11            19  \n",
       "2              4          0        7         7            15  \n",
       "3              5          0       11        11            16  \n",
       "4              6          0       11        11            19  \n",
       "5              4          0       15        15            17  \n",
       "6              9          1       12        12            20  \n",
       "7             16          0       18        18            19  \n",
       "8              5          0        7         7            15  \n",
       "9              7          1        7         7            17  \n",
       "10            12          0       14        14            16  \n",
       "11             6          1       10        10            17  \n",
       "12             6          0        7         7            16  \n",
       "13            11          0       17        17            18  \n",
       "14             7          0        9         9            18  \n",
       "15             5          0        9         9            18  \n",
       "\n",
       "[16 rows x 35 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "euro12 = pd.read_csv(path2)\n",
    "euro12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>81.3%</td>\n",
       "      <td>41</td>\n",
       "      <td>62</td>\n",
       "      <td>2</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>9</td>\n",
       "      <td>60.1%</td>\n",
       "      <td>53</td>\n",
       "      <td>73</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>25</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Team  Goals  Shots on target  Shots off target Shooting Accuracy  \\\n",
       "0         Croatia      4               13                12             51.9%   \n",
       "1  Czech Republic      4               13                18             41.9%   \n",
       "2         Denmark      4               10                10             50.0%   \n",
       "\n",
       "  % Goals-to-shots  Total shots (inc. Blocked)  Hit Woodwork  Penalty goals  \\\n",
       "0            16.0%                          32             0              0   \n",
       "1            12.9%                          39             0              0   \n",
       "2            20.0%                          27             1              0   \n",
       "\n",
       "   Penalties not scored      ...       Saves made  Saves-to-shots ratio  \\\n",
       "0                     0      ...               13                 81.3%   \n",
       "1                     0      ...                9                 60.1%   \n",
       "2                     0      ...               10                 66.7%   \n",
       "\n",
       "   Fouls Won Fouls Conceded  Offsides  Yellow Cards  Red Cards  Subs on  \\\n",
       "0         41             62         2             9          0        9   \n",
       "1         53             73         8             7          0       11   \n",
       "2         25             38         8             4          0        7   \n",
       "\n",
       "   Subs off  Players Used  \n",
       "0         9            16  \n",
       "1        11            19  \n",
       "2         7            15  \n",
       "\n",
       "[3 rows x 35 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "euro12.head(3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题1：有多少球队参与了2012欧洲杯？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(16, 35)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "euro12.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题2：该数据集中一共有多少列(columns)?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 将数据集中的列Team, Yellow Cards和Red Cards单独存为一个名叫discipline的数据框"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Yellow Cards  Red Cards\n",
       "0               Croatia             9          0\n",
       "1        Czech Republic             7          0\n",
       "2               Denmark             4          0\n",
       "3               England             5          0\n",
       "4                France             6          0\n",
       "5               Germany             4          0\n",
       "6                Greece             9          1\n",
       "7                 Italy            16          0\n",
       "8           Netherlands             5          0\n",
       "9                Poland             7          1\n",
       "10             Portugal            12          0\n",
       "11  Republic of Ireland             6          1\n",
       "12               Russia             6          0\n",
       "13                Spain            11          0\n",
       "14               Sweden             7          0\n",
       "15              Ukraine             5          0"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "discipline = euro12[['Team', 'Yellow Cards', 'Red Cards']]\n",
    "discipline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题3：对数据框discipline按照先Red Cards再Yellow Cards进行排序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Yellow Cards  Red Cards\n",
       "7                 Italy            16          0\n",
       "10             Portugal            12          0\n",
       "13                Spain            11          0\n",
       "0               Croatia             9          0\n",
       "1        Czech Republic             7          0\n",
       "14               Sweden             7          0\n",
       "4                France             6          0\n",
       "12               Russia             6          0\n",
       "3               England             5          0\n",
       "8           Netherlands             5          0\n",
       "15              Ukraine             5          0\n",
       "2               Denmark             4          0\n",
       "5               Germany             4          0\n",
       "6                Greece             9          1\n",
       "9                Poland             7          1\n",
       "11  Republic of Ireland             6          1"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "discipline.sort_values(by = ['Red Cards','Yellow Cards'], ascending = [True,False])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题4：计算球队拿到的黄牌数的平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.4375"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "discipline['Yellow Cards'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>16.000000</td>\n",
       "      <td>16.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>7.437500</td>\n",
       "      <td>0.187500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>3.265348</td>\n",
       "      <td>0.403113</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>4.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>5.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>6.500000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>9.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>16.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Yellow Cards  Red Cards\n",
       "count     16.000000  16.000000\n",
       "mean       7.437500   0.187500\n",
       "std        3.265348   0.403113\n",
       "min        4.000000   0.000000\n",
       "25%        5.000000   0.000000\n",
       "50%        6.500000   0.000000\n",
       "75%        9.000000   0.000000\n",
       "max       16.000000   1.000000"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "discipline.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
